﻿@using LanDBom.Models
@using LanDBom.Resources
@{
    ViewBag.Title = "BOMView";
    Layout = "~/Views/Shared/_Genertals.cshtml";
}

<h2>申请单详情</h2>
<div>
    <div class="Zhuyags">
        <div class="col-2 nav-item qh_div" id="divjibeng" style="background-color:#fff">@Resource.String48</div>
        <div class="col-2 nav-item qh_div" id="divbeizhu">@Resource.String49</div>
        <div class="col-2 nav-item qh_div" id="divtuzhi">@Resource.String50</div>
        <div class="col-2 nav-item qh_div" id="divweituo" style="display:none">@Resource.String51</div>
    </div>
    <div class="CSshaia">
        <div id="div1" style="display:block">
            <fieldset class="boun" style="width:96%">
                <legend class="len1">客户详情</legend>
                <table class="table" style="height: 150px;text-align:left;">
                    @foreach (var item in ViewBag.appji as List<Applications>)
                    {
                        <tr>
                            <td>
                                @Html.Label(Resource.String53)
                                @item.App_Kehu
                            </td>
                            <td>
                                @Html.Label(Resource.String430)<label id="shenDan">@item.AP_bian </label>
                            </td>
                        </tr>
                        <tr>
                            <td>@Html.Label(Resource.String431): @item.App_qishi</td>
                            <td>@Html.Label(Resource.String432):@item.App_JTime</td>
                        </tr>
                        <tr>
                            <td>@Html.Label(Resource.String433): @item.APP_name</td>
                            <td>@Html.Label(Resource.String434): @item.App_lei</td>
                        </tr>
                        <tr>
                            <td>@Html.Label(Resource.String435): @item.APP_Zhong</td>
                            <td>@Html.Label(Resource.String436) @item.App_miao</td>
                        </tr>
                        <tr>
                            <td>@Html.Label(Resource.String437):@item.App_dizhi</td>
                            <td>@Html.Label(Resource.String438): @item.App_sho</td>
                        </tr>
                        <tr style="display:none"><td class="SheKO">@item.APP_she</td></tr>
                    }

                </table>
            </fieldset>
        </div>
        @*项目备注*@
        <div id="div2" style="display:none">
            <div class="">
                <div id="bigbox1">
                    <fieldset class="boun" id="boun" style="height:150px">
                        <legend class="len">@Resource.String558</legend>
                        <div id="RZ_gwzr" class="beizhugun">
                        </div>
                    </fieldset>
                </div>
                <div>
                    <fieldset class="boun" id="boun2">
                        <legend class="len">@Resource.String560</legend>
                        <div class="row">
                            <div class="col-2">@Resource.String563</div>
                            <div class="col-8"><textarea id="RZ_xznr" class="col-10" style="height:100px"></textarea></div>
                        </div>
                        <div style="text-align:right">
                            <button id="RZ_tjrz" class="col-2">@Resource.String564</button>
                        </div>
                    </fieldset>
                </div>
                <div>
                    <fieldset class="boun" id="boun3">
                        <legend class="len">@Resource.String565</legend>
                        <table style="width:100%;text-align:center" id="tab_wj">
                            <thead>
                                <tr style="background-color: #84acde">
                                    <td>@Resource.String566</td>
                                    <td>@Resource.String567</td>
                                    <td>@Resource.String568</td>
                                    <td>@Resource.String572</td>
                                    <td>上传</td>
                                </tr>
                            </thead>
                            <tbody id="logfuj">
                            </tbody>
                            <tfoot>
                                <tr>
                                    <td></td>
                                    <td></td>
                                    <td colspan="2"><input type="file" id="SC_FJ_Wj" /></td>
                                    <td><a href="#" id="log_SCFJ">@Resource.String574</a></td>
                                </tr>
                            </tfoot>
                        </table>
                    </fieldset>
                </div>
            </div>
        </div>
        @*图纸备注*@
        <div id="div3" style="display:none">
            <div class="">
                <fieldset class="boun">
                    <legend class="len">@Resource.String84</legend>
                    <table class="table tab">
                        <thead style="text-align:center;">
                            <tr style="background-color: #6e95bc">
                                <td>@Resource.String85</td>
                                <td>@Resource.String86</td>
                                <td>@Resource.String1297</td>
                                <td>@Resource.String87</td>
                                <td>@Resource.String88</td>
                                <td>@Resource.String1298</td>
                                <td>@Resource.String89</td>
                            </tr>
                        </thead>
                        <tbody id="div3__tb">
                        </tbody>
                        <tfoot>
                            <tr>
                                <td>@Resource.String1299</td>
                                <td colspan="4"></td>
                                <td id="SJ_ZYS"></td>
                                <td></td>
                            </tr>
                        </tfoot>
                    </table>
                </fieldset>
            </div>
        </div>
    </div>

    <div title="@Resource.String1010" class="CSshaia">
        <div class="">
            <table class="table table-sm gun">
                <thead class="thead-light">
                    <tr>
                        <th scope="col" style="width:60px;">@Resource.String1286</th>
                        <th scope="col">@Resource.String1287</th>
                        <th scope="col">@Resource.String1288</th>
                        <th scope="col">@Resource.String1289</th>
                        <th>@Resource.String1290</th>
                        <th>@Resource.String1291</th>
                        <th scope="col">@Resource.String1292</th>
                        <th scope="col">@Resource.String1293</th>
                        <th scope="col">@Resource.String1294</th>
                        <th scope="col">@Resource.String1295</th>
                        <th scope="col">@Resource.String1296</th>
                    </tr>
                </thead>

                <tbody data-spy="scroll" id="shdhv">
                    @foreach (var item in ViewBag.fgh as List<BOMini>)
                    {
                        <tr>
                            <td></td>
                            <td><input type="text" class="inwei" value="@item.BOM2_bian" readonly /></td>
                            <td>@item.BOM2_chen</td>
                            <td><input type="text" class="inwei" value="@item.BOM2_wuLiu" readonly /></td>
                            <td><input type="text" class="inwei" value="@item.BOM2_Lei" readonly /></td>
                            <td><input type="text" class="inwei" value="@item.BOM2_Ctime" readonly /></td>
                            <td><input type="text" class="inwei" value="@item.BOM2_Guige" readonly /></td>
                            <td><input type="text" class="inwei" value="@item.BOM2_Nian" readonly /></td>
                            <td><input type="text" class="inwei" value="@item.BOM2_Yong" readonly /></td>
                            <td><input type="text" class="inwei" value="@item.BOM2_fenzi" readonly /></td>
                            <td><input type="text" class="inwei" value="@item.BOM2_mioa" readonly /></td>
                        </tr>
                    }
                </tbody>
            </table>
        </div>
    </div>
    <div>
        <button class="btn" id="back_BOM">返回</button>
    </div>
    @*设计委托信息填写*@
    <div id="div4" style="display:none">
        <div class="">
            <fieldset class="boun">
                <legend class="len">设计委托</legend>
                <table class="sheji table">
                    <tbody>
                        <tr>
                            <td><span>*</span>@Resource.String638</td>
                            <td id="WT_sqrq"></td>
                            <td><span>*</span>@Resource.String639</td>
                            <td><input type="date" id="WT_yqrq" /></td>
                            <td>@Resource.String640</td>
                            <td id="WT_rwdh"></td>
                        </tr>
                        <tr>
                            <td><span>*</span>@Resource.String641</td>
                            <td><input type="text" id="WT_sqr" readonly /></td>
                            <td><span>*</span>@Resource.String642</td>
                            <td><input type="text" id="WT_sqshr" /></td>
                            <td><span>*</span>@Resource.String643</td>
                            <td><input type="number" id="WT_xmjz" /></td>
                        </tr>
                        <tr>
                            <td><span>*</span>@Resource.String644</td>
                            <td style="position:relative">
                                <input type="text" id="WT_khmc" readonly />
                            </td>
                            <td><span>*</span>@Resource.String645</td>
                            <td><input type="text" id="WT_cpmc" readonly /></td>
                            <td>@Resource.String646</td>
                            <td>
                                <select id="WT_rwdlx">
                                    <option value="null">----@Resource.String647----</option>
                                    <option value="图纸">-@Resource.String649</option>
                                    <option value="项目">-@Resource.String650</option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td><span>*</span>@Resource.String652</td>
                            <td id="WT_sjlb">
                                <input type="checkbox" value="结构" class="WT_sjlb_ch" name="WT_sjlb" />@Resource.String654
                                <input type="checkbox" value="平面" class="WT_sjlb_ch" name="WT_sjlb" />@Resource.String656
                                <input type="checkbox" value="整体" class="WT_sjlb_ch" name="WT_sjlb" />@Resource.String658
                            </td>
                            <td><span>*</span>@Resource.String659</td>
                            <td>
                                <select id="WT_dj">
                                    <option value="null">----@Resource.String660----</option>
                                    <option value="A">A</option>
                                    <option value="B">B</option>
                                    <option value="C">C</option>
                                    <option value="D">D</option>
                                </select>
                            </td>
                        </tr>
                        <tr style="display:none">
                            <td>
                                <p></p>
                            </td>
                        </tr>
                        <tr>
                            <td rowspan="3"><span>*</span>@Resource.String661</td>
                            <td>@Resource.String662</td>
                            <td><input type="number" id="WT_cpzl" /></td>
                            <td></td>
                            <td>@Resource.String663</td>
                            <td><input type="text" id="WT_ddsm" /></td>
                        </tr>
                        <tr>
                            <td rowspan="2">@Resource.String664</td>
                            <td rowspan="2" colspan="4"><textarea style="width:100%" id="WT_qtxx"></textarea></td>
                        </tr>
                        <tr style="display:none">
                        </tr>
                        <tr style="display:none">
                            <td>
                                <p></p>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <p></p>
                            </td>
                        </tr>
                        <tr>
                            <td rowspan="9"><span>*</span>@Resource.String665</td>
                            <td>@Resource.String666</td>
                            <td colspan="4" id="WT_ysfs">
                                <input type="checkbox" value="汽车运输" name="WT_ysfs" />@Resource.String667
                                <input type="checkbox" value="铁路运输" name="WT_ysfs" />@Resource.String669
                                <input type="checkbox" value="海轮运输" name="WT_ysfs" />@Resource.String671
                                <input type="checkbox" value="航空运输" name="WT_ysfs" />@Resource.String673
                                <input type="checkbox" value="其他" name="WT_ysfs" />@Resource.String675
                            </td>
                        </tr>
                        <tr>
                            <td>@Resource.String677</td>
                            <td colspan="4" id="WT_bzlx">
                                <input type="checkbox" value="内包装" name="WT_bzlx" />@Resource.String678
                                <input type="checkbox" value="外包装" name="WT_bzlx" />@Resource.String680
                                <input type="checkbox" value="单独包装" name="WT_bzlx" />@Resource.String682
                                <input type="checkbox" value="集合包装" name="WT_bzlx" />@Resource.String684
                            </td>
                        </tr>
                        <tr>
                            <td>@Resource.String686</td>
                            <td colspan="4" id="WT_fhyq">
                                <input type="checkbox" value="防震处理" name="WT_fhyq" />@Resource.String687
                                <input type="checkbox" value="防锈处理" name="WT_fhyq" />@Resource.String689
                                <input type="checkbox" value="防霉处理" name="WT_fhyq" />@Resource.String691
                                <input type="checkbox" value="防潮处理" name="WT_fhyq" />@Resource.String693
                                <input type="checkbox" value="防静电处理" name="WT_fhyq" />@Resource.String695
                                <input type="checkbox" value="屏蔽处理" name="WT_fhyq" />@Resource.String697
                                <input type="checkbox" value="String699" name="WT_fhyq" />@Resource.String699
                            </td>
                        </tr>
                        <tr>
                            <td rowspan="3">@Resource.String701</td>
                            <td rowspan="3" colspan="4"><textarea style="width:100%" id="WT_qtyq"></textarea></td>
                        </tr>
                        <tr></tr>
                        <tr></tr>
                        <tr>
                            <td rowspan="3">@Resource.String702</td>
                            <td rowspan="3" colspan="4"><textarea style="width:100%" id="WT_csyq"></textarea></td>
                        </tr>
                        <tr></tr>
                        <tr></tr>
                        <tr>
                            <td>
                                <p></p>
                            </td>
                        </tr>

                        <tr>
                            <td>
                                <span>*</span>@Resource.String718
                            </td>
                            <td colspan="5" id="WT_xmbzfjxx">
                                <input type="checkbox" value="产品数据" name="WT_xmbzfjxx" />@Resource.String719
                                <input type="checkbox" value="产品图纸" name="WT_xmbzfjxx" />@Resource.String721
                                <input type="checkbox" value="包装图纸" name="WT_xmbzfjxx" />@Resource.String723
                                <input type="checkbox" value="图片" name="WT_xmbzfjxx" />@Resource.String725
                                <input type="checkbox" value="其他" name="WT_xmbzfjxx" />@Resource.String727
                            </td>
                        </tr>
                        <tr>
                            <td colspan="4"></td>
                            <td>@Resource.String729</td>
                            <td><input type="text" id="WT_jdshy" class="Shu1" /></td>
                        </tr>
                        <tr>
                            <td>@Resource.String730</td>
                            <td id="WT_wcrq" colspan="3"></td>
                            <td>@Resource.String731</td>
                            <td><input type="text" id="WT_wcshy" class="Shu1" /></td>
                        </tr>
                    </tbody>
                </table>
            </fieldset>
        </div>
        <div id="APP_sjwt_bz" style="display:none">
            <div>
                * 带"*"由销售填写，其余由设计部门填写；任务单号由系统自动生成；
            </div>
            <div>
                * 接单审核人定义为设计部主管或其指定人员；申请审核人定义为客户经理；任务完成审核定义为设计部主管或其指定人员；
            </div>
            <div>
                * 设计类别中整体设计包含结构设计和平面设计；测试/标准要求没有要求的默认按照国标及兰多标准执行；
            </div>
            <div>
                * 等级分类说明：
            </div>
            <div>
                A级：一般设计类别为结构设计或平面设计；按照客户要求或者按照样品绘制简单结构图纸或者平面图纸（02/03/04系列箱型或则其他类型简单结构），或按照要求核算包装数据（材质，边压，耐破，抗压，重量等），或预计耗费20分钟以下的其他事物；
            </div>
            <div>
                B级：一般设计类别为结构设计或平面设计；按照客户要求或者样品绘制结构图纸+平面图纸或者复杂的结构图纸或则复杂的平面图纸，或按照要求绘制装柜图纸，或预计耗费20-60分钟的其他事物；
            </div>
            <div>
                C级：一般设计类别为整体设计；按照客户要求设计产品包括内衬/内箱/外箱等在内的成套包装设计（结构明细图纸，方案示意图，装柜示意图，平面图），或按照要求绘制装柜图纸，或耗费60-240分钟的其他事物；
            </div>
            <div>
                D级：一般设计类别为整体设计；按照客户要求设计产品复杂的成套包装方案包括内衬/内箱/外箱等在内的成套包装设计（结构明细图纸，方案示意图，装柜示意图，平面示意图），或多种材料综合运用的包装，或可循环类、料架类包装，或按照要求绘制装柜图纸，或耗费240分钟以上的其他事物。
            </div>
        </div>
    </div>

    @section scripts{
        <script src="~/Scripts/jquery-3.4.1.min.js"></script>
        <script>
            //上传项目附件
            $(document).on("click", "#log_SCFJ", function () {
                Upload_attachmentfujian()
            })
            gettbz()
            //日志写入数据库
            $(document).on("click", "#RZ_tjrz", function () {
                var now = new Date($.now());
                var year = (now.getFullYear()).toString();
                var month = (now.getMonth() + 1).toString();
                var date = (now.getDate()).toString();
                var hours = (now.getHours()).toString()
                var minutes = (now.getMinutes()).toString()

                //组合当前日期
                var sqrq = year + "/" + month + "/" + date + " " + hours + ":" + minutes
                var rzxx = {
                    B_Bian: $("#shenDan").text(),
                    B_BR: $('#Login_N').text(),
                    B_Date: sqrq,
                    B_bei: $('#RZ_xznr').val(),

                };
                console.log(rzxx)
                $.ajax({
                    url: "/Contracts/AddLogs",
                    type: "POST",
                    data: rzxx,
                    success: function (data) {
                        alert(data)
                        gettbz()
                    },
                    error: function (data) {
                        alert("erroer");
                    },
                })
            })
            function Upload_attachmentfujian() {
                var fileUpload = $('#SC_FJ_Wj')[0];
                if (fileUpload.files.length > 0) {
                    var fileData = new FormData();
                    fileData.append('file', fileUpload.files[0]);
                    var now = new Date($.now());
                    var year = (now.getFullYear()).toString();
                    var month = (now.getMonth() + 1).toString();
                    var date = (now.getDate()).toString();
                    var hours = (now.getHours()).toString()
                    var minutes = (now.getMinutes()).toString()
                    var name = $("#Login_N").text()
                    //组合当前日期
                    var sqrq = year + "/" + month + "/" + date + " " + hours + ":" + minutes
                    $.ajax({
                        url: '/Contracts/AddNdardo',
                        type: 'POST',
                        contentType: false, // 不设置内容类型
                        processData: false, // 不处理数据
                        data: fileData,
                        success: function (response) {
                            var BZJG = [];
                            BZJG.push({
                                DE_dizhi: response,
                                DE_shijian: sqrq,
                                DE_shen: $('#shenDan').text(),
                                De_ren: name,
                                DE_lei: "附件"
                            })
                            $.ajax({
                                url: '/Contracts/adddes',
                                type: 'POST',
                                contentType: "application/json;charset=utf-8", // 不设置内容类型
                                dataType: "json",
                                processData: false, // 不处理数据
                                data: JSON.stringify(BZJG), fileData,
                                success: function (response) {
                                    alert("文件上传成功")
                                    Load_design_table()
                                },
                                error: function (jqXHR, textStatus, errorMessage) {
                                    alert('AJAX请求失败：' + errorMessage);
                                }
                            });
                        },
                        error: function (jqXHR, textStatus, errorMessage) {
                            alert('AJAX请求失败：' + errorMessage);
                        }
                    });
                }
                else {
                    alert('请选择要上传的文件！');
                }
            }

            //获取备注信息
            function gettbz() {
                var kan = $("#shenDan").text();
                $.ajax({
                    url: "/Application/Application",
                    type: "POST",
                    data: { "App_ban": kan, "state": 4 },
                    success: function (sjik) {
                        $("#RZ_gwzr div").remove();
                        $.each(sjik, function (i, item) {
                            var $tr = $(`
                        <div>
                            <div>
                                <span style="color:red">${item.B_BR}</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>${item.B_Date}</span>
                            </div>
                            <div style="border-bottom:1px solid #808080">
                                ${item.B_bei}
                            </div>
                        </div>`);
                            $("#RZ_gwzr").append($tr);
                        })
                    },
                    error: function () {
                        alert("erroer");
                    },
                })
            }
            $(document).on("click", "#back_BOM", function () {
                var B_dan = $("#shenDan").text()
                window.location.href = "/Detailed/Boms?names=" + B_dan;
            })
            $(function () {
                var len = $("#shdhv tr").length;
                for (var i = 0; i < len; i++) {
                    $('#shdhv tr:eq(' + i + ') td:nth-child(1)').text(i + 1);
                }

                $("#shdhv tr td .inwei").css({ "border": 0 });
                if ($(".SheKO").text()=="N") {
                    $("#divweituo").show()
                }
            })
            //实现页面显示BOM
            $(function () {
                gettbz()//搜索备注信息
                $('select[name="selop"]').change(function () {
                    var shun = $('select[name="selop"] option:selected').val();
                    var ghjd = $("#shenDan").text();
                    $.ajax({
                        url: "/Detailed/Boms",
                        type: "POST",
                        data: { "binaed": shun, "hudnf": ghjd, "state": 3 },
                        success: function (sdf) {
                            creaBOM(sdf);
                        },
                        error: function () {
                            alert("erroer");
                        },
                    })
                })
                //获取图纸信息
            Load_design_table()
            //获取图纸信息
            function Load_design_table() {
                $.ajax({
                    url: '/Application/Application',
                    type: 'POST',
                    data: { "state": 3, "App_ban": $('#txtdan').val() },
                    success: function (path) {
                        createFJ(path)
                    },
                    error: function () {
                        alert("系统错误!");
                    }
                })
            }
            function createFJ(fgggh) {
                $("#logfuj tr").remove();
                $("#div3__tb tr").remove();
                var ind1 = 1
                var ind2 = 1
                var temp=0
                $.each(fgggh, function (i, item) {
                    var x = item.De_dizhi
                    if (item.DE_lei == "图纸") {
                        var $tr = (`
                        <tr class="log_tr">
                            <td style="display:none">${item.DE_id}</td>
                            <td>${ind1}</td>
                            <td>${item.De_dizhi}</td>
                            <td>${item.bom_id}</td>
                            <td>${item.De_shijian}</td>
                            <td>${item.De_ren}</td>
                            <td>
                                <input type="number" readonly="readonly" value="${item.DE_Slong}" style="width:60px;height:30px"/>
                            </td>
                            <td><a href="#" id="log_SC">删除</a>/<a href="/Contracts/Download_file?path=${x}" id="log_SZ">@Resource.String582</a></td>
                        </tr>`);
                        $("#div3__tb").append($tr);
                        ind1++
                        temp += item.DE_Slong*1
                    }
                    else {
                        var $tr = (`
                        <tr class="log_tr">
                            <td style="display:none">${item.DE_id}</td>
                            <td>${ind2}</td>
                            <td>${item.De_dizhi}</td>
                            <td>${item.De_shijian}</td>
                            <td>${item.De_ren}</td>
                            <td><a href="/Contracts/Download_file?path=${x}" id="log_SZ">@Resource.String582</a></td>
                        </tr>`);
                        $("#div3__tb").append($tr);
                        ind2++
                    }
                })
                $("#SJ_ZYS").text(temp)
            }
                function getContracts() {
                    var DTon = $('#txtdan').val()
                    $.ajax({
                        url: "/Contracts/Design_order",
                        type: 'GET',
                        data: { "state": 1, "DTon": DTon },
                        success: function (data) {
                            Show_old_data(data);
                        },
                        error: function () {
                            alert('Request Error');
                        }
                    })
                }

                //写入旧数据的方法
                function Show_old_data(data) {
                    $.each(data, function (i, item) {
                        $("#WT_sqrq").text(item.D_Applic)
                        $("#WT_yqrq").val(item.D_reDate)
                        $("#WT_rwdh").text(item.D_Ton)
                        $("#WT_sqr").val(item.D_App)
                        $("#WT_sqshr").val(item.D_AppRevi)
                        $("#WT_khmc").val(item.D_CN)
                        $("#WT_cpmc").val(item.D_PN)
                        $("#WT_dj").val(item.D_LV)
                        $("#WT_sjhs").val(item.D_DT)
                        $('#WT_cpzl').val(item.D_PW)
                        $('#WT_ddsm').val(item.D_SI)
                        $('#WT_qtxx').val(item.D_OI)
                        $('#WT_qtyq').val(item.D_OR)
                        $('#WT_csyq').val(item.D_SR)
                        $('#WT_jdr').val(item.D_REC)
                        $('#WT_jdshy').val(item.D_AR)
                        $('#WT_wcrq').text(item.D_CD)
                        $('#WT_wcshy').val(item.D_TCA)
                        $('#WT_xmjz').val(item.D_price)
                        $("#WT_bz").text(item.D_zhuang)
                        $('#WT_rwdlx').val(item.D_take)
                        console.log($("WT_bz").text())
                        //设计类别
                        if (item.D_DE != null) {
                            var D_DE = item.D_DE.split(" ")
                            D_DE.pop()
                            console.log(D_DE)
                            $("input[name='WT_sjlb']").each(function (i, a) {
                                if (D_DE.includes(a.value) == true) {
                                    a.checked = true
                                }
                            })
                        }
                        //任务单类型
                        if (item.D_take != null) {
                            var D_DE = item.D_take.split(" ")
                            D_DE.pop()
                            console.log(D_DE)
                            $("input[name='WT_sjlb']").each(function (i, a) {
                                if (D_DE.includes(a.value) == true) {
                                    a.checked = true
                                }
                            })
                        }
                        if (item.D_MOF != null) {
                            //运输方式
                            var D_MOF = item.D_MOF.split(" ")
                            D_MOF.pop()
                            console.log(D_MOF)
                            $("input[name='WT_ysfs']").each(function (i, b) {
                                if (D_MOF.includes(b.value) == true) {
                                    b.checked = true
                                }
                            })
                        }
                        if (item.D_PT != null) {
                            //包装方式
                            var D_PT = item.D_PT.split(" ")
                            D_PT.pop()
                            console.log(D_PT)
                            $("input[name='WT_bzlx']").each(function (i, c) {
                                if (D_PT.includes(c.value) == true) {
                                    c.checked = true
                                }
                            })
                        }
                        if (item.D_PR != null) {
                            //防护要求
                            var D_PR = item.D_PR.split(" ")
                            D_PR.pop()
                            console.log(D_PR)
                            $("input[name='WT_fhyq']").each(function (i, d) {
                                if (D_PR.includes(d.value) == true) {
                                    d.checked = true
                                }
                            })
                        }
                        if (item.D_PA != null) {
                            //项目附件
                            var D_PA = item.D_PA.split(" ")
                            D_PA.pop()
                            console.log(D_PA)
                            $("input[name='WT_xmbzfjxx']").each(function (i, e) {
                                if (D_PA.includes(e.value) == true) {
                                    e.checked = true
                                }
                            })
                        }

                    })
                }

            })//获取图纸信息//点击切换基础信息，备注信息，图纸沟通
            $(function () {
                $("#divjibeng").click(function (e) {
                    $("#div1,.CSshaia").css({ "display": "block" });
                    $("#div2").css({ "display": "none" });
                    $("#div3").css({ "display": "none" });
                    $("#div4").css({ "display": "none" });
                    $("#div5").css({ "display": "none" });
                    $("#APP_WLSQ").css({ "display": "block" })
                    $("#APP_sjwt_bz").css({ "display": "none" })
                })
                $("#divbeizhu").click(function (e) {
                    $("#div2,CSshaia").css({ "display": "block" });
                    $("#div1").css({ "display": "none" });
                    $("#div3").css({ "display": "none" });
                    $("#div4").css({ "display": "none" });
                    $("#div5").css({ "display": "none" });
                    $("#APP_WLSQ").css({ "display": "none" })
                    $("#APP_sjwt_bz").css({ "display": "none" })
                })
                $("#divtuzhi").click(function (e) {
                    $("#div3,CSshaia").css({ "display": "block" });
                    $("#div1").css({ "display": "none" });
                    $("#div2").css({ "display": "none" });
                    $("#div4").css({ "display": "none" });
                    $("#div5").css({ "display": "none" });
                    $("#APP_WLSQ").css({ "display": "none" })
                    $("#APP_sjwt_bz").css({ "display": "none" })
                })
                $(document).on("click", "#divweituo", function () {
                    $("#div3").css({ "display": "none" });
                    $("#div1").css({ "display": "none" });
                    $("#div2,.CSshaia").css({ "display": "none" });
                    $("#div4").css({ "display": "block" });
                    $("#APP_WLSQ").css({ "display": "none" })
                    $("#APP_sjwt_bz").css({ "display": "block" })
                    $("#WT_cpmc").val($("#txtxiangmu").val())
                    $("#WT_khmc").val($("#txtname").val())
                })
                $(document).on("click", ".qh_div", function (e) {
                    $(e.target).parent().children().css({ "background-color": "#ededed" })
                    $(e.target).css({ "background-color": "white" })
                })
            })
            //获取备注信息
            function gettbz() {
                var kan = $("#shenDan").text();
                $.ajax({
                    url: "/Application/Application",
                    type: "POST",
                    data: { "App_ban": kan, "state": 4 },
                    success: function (sjik) {
                        $("#RZ_gwzr div").remove();
                        $.each(sjik, function (i, item) {
                            var $tr = $(`
                                <div>
                                    <div>
                                        <span>${item.B_BR}</span><span>${item.B_Date}</span>
                                    </div>
                                    <div>
                                        ${item.B_bei}
                                    </div>
                                </div>`);
                            $("#RZ_gwzr").append($tr);
                        })
                    },
                    error: function () {
                        alert("erroer");
                    },
                })
            }
        </script>
    }
</div>

